package com.example.action;

import com.example.enums.Events;
import com.example.enums.Status;
import com.example.po.SysSms;
import com.example.service.SysSmsServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.messaging.Message;
import org.springframework.statemachine.StateContext;
import org.springframework.statemachine.action.Action;

public class SmsCommitAction implements Action<Status, Events> {

    Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public void execute(StateContext<Status, Events> context) {
        Message<Events> message = context.getMessage();
        if (message != null) {
            SysSms sysSms = (SysSms) message.getHeaders().get(SysSmsServiceImpl.SMS);
            logger.warn("短信id：" + sysSms.getId() + " 触发了发送确认事件");
        }
    }
}
